

function [targetStrings] = HR_FindAllTargetStringsRecursive(s1NrTargets, s1OlTargets, s2NrTargets, s2OlTargets, prefix_old)

targetStrings = [];

if (nargin == 4)
    prefix_old = [];
end

if s1NrTargets==s2NrTargets && all(s1OlTargets == s2OlTargets)
    targetStrings.string = [prefix_old s1OlTargets];
    return;
end
    

if (s1NrTargets < s2NrTargets )
    stringA = s1OlTargets;
    stringB = s2OlTargets;
    nrTargets = s1NrTargets;
else
    stringB = s1OlTargets;
    stringA = s2OlTargets;
    nrTargets = s2NrTargets;
end

for b = 1:nrTargets
    idx = find(stringA(b) == stringB(:) );
    if ~isempty(idx)
        prefix = [prefix_old stringA(b)];
        substringA = stringA(b+1:end);
        
        substringB = stringB(idx+1:end);
        
        matchingStrings = [];
        
        if length(substringA)==length(substringB) && all(substringA == substringB)
            matchingStrings.string = [prefix substringB];
        else
            matchingStrings = HR_FindAllTargetStringsRecursive(length(substringB), substringB, length(substringA), substringA, prefix);
        end
        
        if (isempty(targetStrings))
            targetStrings = matchingStrings;
        else
            targetStrings(end+(1:length(matchingStrings))) = matchingStrings;
        end
        
    end
end

if isempty(targetStrings)
    targetStrings.string = prefix_old;
end    

end % function